<?php
/**
 * PHP Daycare
 * This file is used to obtain a adults's picture from the database. Use it like this: <img src="aimg.php?id=5" />
 * @author Jason Butz
 * @version 0.0
 * @package PHPDaycare
 */

//--------------------
// NOTE:
//		This has been tested and SHOULD work fine!

include_once("functions.php");
// Make sure the user is logged in before allowing them to view the photos
header("Content-type: image/jpeg");
session_start();
if($session->isloggedin())
{
	// We can proceed
	$r = $db->query("SELECT photo FROM adults WHERE ID='".$_GET['id']."';");
	if(!$r)
	{
		die('Error');
	}
	$row = mysql_fetch_row($r);
	// We have an image
	//header('Content-type: image/jpeg');
	//echo $row['photo'];
	//$rset = @mysql_fetch_assoc($r);
	//$imagebytes = $rset[photo];
	$imagebytes = $row[0];

	print $imagebytes;
}
else
{
	die("NOT LOGGED IN");
}
?>
